<?php
/**
 * Created by PhpStorm.
 * User: this
 * Date: 2018/12/12
 * Time: 16:04
 */
namespace app\admin\model;

use think\Model;

class Set extends Model{
    /**
     * @param $condition
     * @param string $field
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getList($condition,$field = '*'){
        return $this->name('setting')->field($field)->where($condition)->select();
    }

    /**
     * @param $condition
     * @param string $field
     * @return array|false|\PDOStatement|string|Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getOne($condition,$field = '*'){
        return $this->name('setting')->field($field)->where($condition)->find();
    }


    /**
     * @param $condition
     * @param $data
     * @return $this
     */
    public function edit($condition,$data){
        return $this->name('setting')->where($condition)->update($data);
    }
}